<?php

defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$uniacid = $_SESSION['uniacid'];
$mid = $_SESSION['uid'];
$basic=$this->plugin_setting('basic');
$return['advs']=$basic['image'];
$return['basic']=$basic;

if($_RQ['op']=='main'){
	$goodsid = intval($_RQ['goodsid']);
	$groupid = intval($_RQ['groupid']);
//	print_r($groupid.'jffffjj');exit;
	if (empty($goodsid)) 
	{
		exi('你访问的商品不存在!', 'error');
	}
	if (empty($groupid)) 
	{
		exi('你访问的活动不存在!','error');
	}
	$goods = pdo_fetch('select * from ' . tablename('jy_weishop_goods') . "\r\n\t\t\t\t\t" . 'where id = :id and status = :status and uniacid = :uniacid order by paixu desc', array(':id' => $goodsid, ':uniacid' => $uniacid, ':status' => 1));
	$group=pdo_get('jy_aligroup_groups',array('uniacid'=>$_SESSION['uniacid'],'id'=>$groupid));
	if(!$group['feetype'] && $group['agio']!=0){
		$goods['groupsprice'] = $group['agio']*$goods['price']/100;
	}elseif($group['feetype'] && $group['price']!=0){
		$goods['groupsprice'] = $group['price'];
	}else{
		$goods['groupsprice'] =$goods['price'];
	}
	$return['goods']=$goods;
	$return['group']=$group;
//print_r($group);exit;
	exi($return);
	
	
	
}   